﻿@model MoveCategoryViewModel
<style type="text/css">
    .popup-content
    {
        width: 400px;
        height: 300px;
        overflow: auto;
        border: 1px solid #D9DFE4;
    }
</style>
<script type="text/javascript">

    $(document).ready(function () {

        $("#btnClose, #btnCancel").click(function (e) {
            // Move Category PopUp - destroy categories tree, and hidden values
            $("#treeParentCategories").dynatree("destroy");
            $("#treeParentCategories").empty();
            $("#categoryIdToMove").val("");
            $("#newParentCategoryId").val("");
            //=================================================================
        });

        $("#formCategoryMove").submit(function (e) {

            var newParentCategoryId = $("#newParentCategoryId").val();

            if (!newParentCategoryId || newParentCategoryId == "") {
                if (!confirm("If you'll not check new parent category, category will be moved to the root. Do you want to move it to the root?")) {
                    e.preventDefault();
                }
            }
        });
    });

</script>
<div id="overlay" class="web_dialog_overlay">
</div>
<div id="@ViewData["PopUpID"]" class="web_dialog">
    <table style="width: 100%; border: 0px;" cellpadding="3" cellspacing="0">
        <tr>
            <td class="web_dialog_title">
                Chose Parent Categories
            </td>
            <td class="web_dialog_title align_right">
                <a href="#" id="btnClose">X</a>
            </td>
        </tr>
        <tr>
            <td class="dialogContent" colspan="2">
                <div class="popup-content">
                    <div id="treeParentCategoriesContent">
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="padding: 5px;">
                @using (Html.BeginForm("CategoryMove", "Categories", FormMethod.Post, new { id = "formCategoryMove" }))
                {
                    @Html.Hidden("categoryIdToMove")
                    @Html.Hidden("newParentCategoryId")
                    <div class="zatify_panel_btn">
                        <input id="btnSave" type="submit" onclick="" class="btn apps_btn apps_gray_btn" value="Save" />
                        <input id="btnCancel" type="button" class="btn apps_btn apps_gray_btn" value="Cancel" />
                    </div>
                }
            </td>
        </tr>
    </table>
</div>
